import type {
  IPanelItemProvider,
  PanelController,
  PanelItemController,
} from "@ibiz-template/runtime";
import type { IPanelContainer } from "@ibiz/model-core";
import { PanelContainerController } from "./i-biz-panel-container.controller";

/**
 * 面板容器适配器
 *
 * @export
 * @class PanelContainerProvider
 * @implements {IPanelItemProvider}
 */
export class PanelContainerProvider implements IPanelItemProvider {
  component: string = "IBizPanelContainer";

  async createController(
    panelItem: IPanelContainer,
    panel: PanelController,
    parent: PanelItemController | undefined
  ): Promise<PanelItemController> {
    const c = new PanelContainerController(panelItem, panel, parent);
    await c.init();
    return c;
  }
}
